//
//  UIViewController+Fantasia.m
//  Fantasia
//
//  Created by kongkong on 16/9/17.
//  Copyright © 2016年 Kongkong. All rights reserved.
//

#import "UIViewController+Fantasia.h"

char *const NavigationBarHiddenKey = "fanNavigationBarHidden";
char *const NavigationBarRightButons = "fanNavigationBarRightButons";

NSString *const GlobalNavigationControllerKey = @"GlobalNavigationControllerKey";

@implementation UIViewController (Fantasia)

-(void)setFanNavigationBarHidden:(BOOL)fanNavigationBarHidden {
    [self associateValue:@(fanNavigationBarHidden) withKey:NavigationBarHiddenKey];
}

- (BOOL)fanNavigationBarHidden {
    return [[self associatedValueForKey:NavigationBarHiddenKey]boolValue];
}

+ (UINavigationController *)rootNavigationController{
    return [[FantasiaStorage instance] memoryValueForKey:GlobalNavigationControllerKey];
}

- (UINavigationController *)rootNavigationController {
    return [UIViewController rootNavigationController];
}

- (void)setRightButtons:(NSArray *)rightButtons{
    [self associateValue:rightButtons withKey:NavigationBarRightButons];
}

- (NSArray *)rightButtons{
    return [self associatedValueForKey:NavigationBarRightButons];
}
@end
